package com.sailing.core.demo.yoho;


public class ProductDetailHtmlUitl {
	

	public static String fixHtml(String infoWithHtml){
		String result = "";
		if(infoWithHtml == null){
			return result;
		}
		String br = "<br />";
		String noWords = infoWithHtml.contains(br) ? infoWithHtml.substring(infoWithHtml.indexOf(br)) : infoWithHtml;
		
		//'\r\n\t' => '',
		result = noWords.replaceAll("\r\n\t", "");
         //       '</p>' => '',
		result = result.replaceAll("</p>", "");
         //       '<br />' => "\r\n",
		result = result.replaceAll("<br />", "\r\n");
		String imgPrefix = "<img class=\"lazy\" src=\"\" data-original=\"";
         //       '<img src=' => "<img class=\"lazy\" src=\"\" data-original=",
		result = result.replaceAll("<img src=", imgPrefix);
		
		return result;
	}
	
	
	public static void main(String[] args) {
		System.out.println("what is the hell");
		String info = "<p>\n" +
				"\tSIXVISION机械的生命卡通短袖TEE ，一个机械与生命的结合，畸形的状态，但人们似乎不以为然 ， SIXVISION机械的生命卡通短袖TEE全棉设计，上身穿着舒适，非常适合春夏！与众不同！<br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<img src=\"http://img03.static.yohobuy.com/thumb/2011/06/23/04/02f761cafb1cdf0280c5b6774a095314cf-0750x1500-1-goodsimg.jpg\" /></p>\n" +
				"<p>\n" +
				"\t<img src=\"http://img03.static.yohobuy.com/thumb/2011/06/23/04/02561cf2ef38098325e757dd5fbe5769a3-0750x1500-1-goodsimg.jpg\" /><br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02425c899faee8c5b183e5678b0720874e-0750x1500-1-goodsimg.jpg\" /><br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/020338b404688a8d447c42a64a2e125339-0750x1500-1-goodsimg.jpg\" /><br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<img src=\"http://img03.static.yohobuy.com/thumb/2011/06/23/04/026761c7702d36eb8bbcc28539b3b92c41-0750x1500-1-goodsimg.jpg\" /><br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<br />\n" +
				"\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02f093eade1383f1dd003fa61eeb25f1f0-0750x1500-1-goodsimg.jpg\" /><br />\n" +
				"\t<br />\n" +
				"\t&nbsp;</p>";

		System.out.println(fixHtml(info));

	}
}
